import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:goodhouse/pages/Ai.dart';
import 'package:goodhouse/pages/buy.dart';
import 'package:goodhouse/pages/doctor.dart';
import 'package:goodhouse/pages/dollar.dart';
import 'package:goodhouse/pages/history.dart';
import 'package:goodhouse/pages/home/index.dart';
import 'package:goodhouse/pages/home/room_add/index.dart';
import 'package:goodhouse/pages/home/room_manager/index.dart';
import 'package:goodhouse/pages/id.dart';
import 'package:goodhouse/pages/login.dart';
import 'package:goodhouse/pages/pap.dart';
import 'package:goodhouse/pages/register.dart';
import 'package:goodhouse/pages/room_detail/index.dart';
import 'package:goodhouse/pages/skin.dart';
import 'package:goodhouse/pages/xiaobu.dart';
import 'package:goodhouse/setting.dart';

import 'pages/not_found.dart';

class Routes {
  // 定义路由名称
  static String home = '/';
  static String login = 'login';
  static String register = '/register';
  static String setting = '/setting';
  static String roomManage = '/roomManage';
  static String roomAdd = '/roomAdd';
  static String roomDetail = '/roomDetail/:roomId';
  static String ai = '/Ai';
  static String skin='/skin';
  static String dollar='/dollar';
  static String history= '/history';
  static String buy ='/buy';
  static String doctor='/doctor';
  static String id='/id';
  static String pap='/pap';
  static String xiaobu='/xiaobu';



  // 定义路由处理函数

  // var rootHandler = Handler(
  //     handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
  //   return HomePage();
  // });
  static Handler _homeHandler = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return HomePage();
      });

  static Handler _loginHandler = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return LoginPage();
      });

  static Handler _registerHanlder = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage();
      });

  static Handler _settingHanlder = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return SettingPage();
      });

  static Handler _roomManageHanlder = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RoomManagerPage();
      });

  static Handler _roomAddHanlder = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RoomAddPage();
      });

  static Handler _notFoundHandler = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return NotFoundPage();
      });
  static Handler _aiHandler = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage1();
      });
  static Handler _skin = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage2();
      });
  static Handler _dollar = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage3();
      });
  static Handler _history = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage4();
      });
  static Handler _buy = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage5();
      });

  static Handler _id = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage7();
      });
  static Handler _doctor = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage6();
      });
  // static Handler _xiaobu = Handler(
  //     handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
  //       return RegisterPage9();
  //     });
  static Handler _pap = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RegisterPage8();
      });
  static Handler _roomDetailHandler = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        return RoomDetailPage(
          roomId: params['roomId']![0],
        );
      });

  // 编写路由处理函数
  static void configureRoutes(FluroRouter router) {
    // router.notFoundHandler = Handler(
    //     handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    //   print("ROUTE WAS NOT FOUND !!!");
    //   return;
    // });

    router.define(home, handler: _homeHandler);
    router.define(login, handler: _loginHandler);
    router.define(register, handler: _registerHanlder);
    router.define(setting, handler: _settingHanlder);
    router.define(roomManage, handler: _roomManageHanlder);
    router.define(roomAdd, handler: _roomAddHanlder);
    router.define(roomDetail, handler: _roomDetailHandler);
    router.define(ai,handler: _aiHandler);
    router.define(skin,handler: _skin);
    router.define(dollar,handler: _dollar);
    router.define(history,handler: _history);
    router.define(buy,handler: _buy);
    router.define(doctor,handler: _doctor);
    router.define(id,handler: _id);
    router.define(pap,handler: _pap);
    // router.define(xiaobu,handler: _xiaobu);
    router.notFoundHandler = _notFoundHandler;

    // router.define(root, handler: rootHandler);
    // router.define(demoSimple, handler: demoRouteHandler);
    // router.define(demoSimpleFixedTrans,
    //     handler: demoRouteHandler, transitionType: TransitionType.inFromLeft);
    // router.define(demoFunc, handler: demoFunctionHandler);
    // router.define(deepLink, handler: deepLinkHandler);
  }
}
